<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head>
    <title>运营商通话记录表</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <meta name="author" content="">
    <meta name="keywords" content="">
    <link th:href="@{/loanStatic/mobileinfo/css/base.css}" type="text/css" rel="stylesheet"/>
    <link th:href="@{/loanStatic/mobileinfo/css/editTable.css}" type="text/css" rel="stylesheet"/>
    <script language="javascript" type="text/javascript"
            th:src="@{/loanStatic/mobileinfo/js/jquery-1.7.2.min.js}"></script>
    <script language="javascript" type="text/javascript" th:src="@{/loanStatic/mobileinfo/js/editTable.js}"></script>
</head>
<body>
<table class="edtitable">
    <input type="hidden" id="realname" th:value="${user.realName}">
    <thead>
    <tr>
        <th colspan="7">真实姓名：<span th:text="${user.realName}"
                                   style="color:red"></span>&nbsp;&nbsp;-&nbsp;&nbsp;手机号：<span th:text="${user.mobile}"
                                                                                               style="color:red"></span>&nbsp;的通话记录
        </th>
    </tr>
    </thead>
    <tbody>
    <tr>
        <th>本机号码</th>
        <th>呼叫类型</th>
        <th>对方号码</th>
        <th>通话时间</th>
        <th>通话时长(秒)</th>
        <th>通话地点</th>
        <th>通话类型</th>
    </tr>
    <tr th:each="mobile,mobileStatus : ${infomodels}">
        <td th:text="${mobile.cell_phone}"></td>
        <td th:text="${mobile.init_type}"></td>
        <td th:text="${mobile.other_cell_phone}"></td>
        <td th:text="${mobile.start_time}"></td>
        <td th:text="${mobile.use_time}"></td>
        <td th:text="${mobile.place}"></td>
        <td th:text="${mobile.call_type}"></td>

    </tr>
    </tbody>
</table>

<script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.0.272/jspdf.debug.js"></script>
<!--以上两个文件是js把html转pdf文件的两个库 -->
<script>
    $(function () {
        downloadresume();
        var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
        parent.layer.close(index);
    });

    //html文件转成pdf格式文件函数
    function downloadresume() {
        var pdf = new jsPDF('p', 'pt', 'a4');
        pdf.internal.scaleFactor = 1;
        var options = {
            pagesplit: true
        };
        //$('.pdf-wrapper')
        pdf.addHTML($(".edtitable"), options, function () {
            console.log(pdf);
            pdf.save($("#realname").val() + '通话记录.pdf');
        });
    }
</script>

</body>
</html>